<% layout('/layouts/default.html', {title: '融资服务订单管理', libs: ['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text('融资服务订单详情')}
				<% if (hasPermi('financing:finserviceorder:finServiceOrder:edit') && (finServiceOrder.customerTotalInterest == null || finServiceOrder.customerTotalInterest == '')){ %>
				<a href="${ctx}/financing/finserviceorder/finServiceOrder/finCuREFrom?financingServiceOrderId=${finServiceOrder.financingServiceOrderId}" id="bt2"
				   class="btn btn-primary addTabPage" title="${text('客户还款')}"
				   data-layer="true" data-layer-width="600" data-layer-height="400" > ${text('客户还款')}</a>
				<% } %>
				<% if (hasPermi('financing:finserviceorder:finServiceOrder:edit') && (finServiceOrder.investorTotalInterest == null || finServiceOrder.investorTotalInterest == '')){ %>
				<a href="${ctx}/financing:finserviceorder:finServiceOrder:/finInREFrom?financingServiceOrderId=${finServiceOrder.financingServiceOrderId}" id="bt3"
				   class="btn btn-primary addTabPage" title="${text('还款到资方')}"
				   data-layer="true" data-layer-width="600" data-layer-height="400" > ${text('还款到资方')}</a>
				<% } %>
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${finServiceOrder}" action="${ctx}/financing/finserviceorder/finServiceOrder/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('基本信息')}</div>
			<#form:hidden path="financingServiceOrderId"/>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('编号')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="financingServiceOrderCode" maxlength="100" class="form-control" disabled="true" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('客户')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
                            <#form:select path="customerId" items="${customerList}" readonly="true"
                            itemLabel="customerName" itemValue="customerId" blankOption="true"
                            class="form-control"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('车架号')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
                            <#form:input path="frameNumber" readonly="true" class="form-control " disabled="true" />
                            <!--<#form:select path="frameNumber" id="frameNumber" items="${listFrameNumber}" readonly="true"
                            itemLabel="value" itemValue="value" blankOption="true" class="form-control required"/>-->
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('代理公司')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
                            <#form:select path="companyId" id="company" items="${companyList}"
                            itemLabel="companyName" itemValue="companyCode" blankOption="true" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('车款总金额')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="carTotalAmount" class="form-control required number" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('版型')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="area" dictType="car_quyu" blankOption="true" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('车型')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input  path="model" blankOption="true" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('品牌')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="brand" dictType="car_pinpai" blankOption="true" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control" readonly="true"
								/>
							</div>
						</div>
					</div>
				</div>
				<h4 class="form-unit">${text('状态')}</h4>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('状态')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="recordStatus" dictType="financing_service_order_status" blankOption="true" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div style="width:50%;height:50px;"></div>
				<h4 class="form-unit">${text('融资信息-资方')}</h4>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('国内资方')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
                            <#form:select path="investorId" class="form-control required" items="${supplierList}"
                            itemLabel="supplierName" itemValue="supplierId"  readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('计息方式')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="calculationMethod" dictType="erp_calc_interest" class="form-control required" readonly="true" />
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('融资地点')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
                            <#form:select path="financingLocation" class="form-control required" items="${twarehouseList}"
                            itemLabel="warehouseName" itemValue="warehouseId" readonly="true" />
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('融资方式')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="financingMethod" dictType="financing_method" class="form-control required" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('最少天数')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="minimumDay" class="form-control required digits" readonly="true"/>
						</div>
					</div>
				</div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">${text('开始日期')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="supplierStartDate" readonly="true" maxlength="20" class="form-control laydate"
                            dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="getTaxByinvestorName()" disabled="true"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required ">*</span> ${text('国内融资方案')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="groupName" readonly="true" class="form-control " disabled="true" />

                           <!-- <#form:select path="groupName" id="groupName" items="${listGroupName}"
                            itemLabel="groupName" itemValue="groupName" blankOption="true" class="form-control required" />-->
                        </div>
                    </div>
                </div>
				<div style="width:50%;height:173px;"></div>
				<div class="ml10 mr10">
					<table id="tfinancingServiceOrderDetailDataGrid1"></table>
				</div>
				<h4 class="form-unit">${text('融资信息-客户')}</h4>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">${text('开始日期')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="customerStartDate" readonly="true" maxlength="20" class="form-control laydate "
                            dataFormat="date" data-type="date" data-format="yyyy-MM-dd" disabled="true" />
                        </div>
                    </div>
                </div>
                <div style="width:50%;height:50px;"></div>
				<div class="ml10 mr10">
					<table id="tfinancingServiceOrderDetailDataGrid2"></table>
				</div>
				<h4 class="form-unit">${text('还款信息-到资方')}</h4>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('还款日期')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="investorRepaymentDate" readonly="true" maxlength="20" class="form-control laydate "
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('发生天数')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="investorDays" class="form-control  digits" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('利息合计')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="investorTotalInterest" class="form-control number" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('本息合计')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="investorTotalPrincipalInterest" class="form-control  number" disabled="true"/>
						</div>
					</div>
				</div>
				<h4 class="form-unit">${text('还款日期-客户')}</h4>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('还款日期')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="customerRepaymentDate" readonly="true" maxlength="20" class="form-control laydate "
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('发生天数')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="customerDays" class="form-control  digits" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('客户利息合计')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="customerTotalInterest" class="form-control  number" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('客户本息合计')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="customerTotalPrincipalInterest" class="form-control  number" disabled="true"/>
						</div>
					</div>
				</div>
				<h4 class="form-unit">${text('附件上传')}</h4>
				<div class="row">
                    <div class="col-xs-12">
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                <span class="required hide">*</span> ${text('附件上传')}：</label>
                            <div class="col-sm-10">
                                <#form:fileupload id="uploadFile" bizKey="${finServiceOrder.id}" bizType="finServiceOrder_file"
                                    uploadType="all" class="" readonly="true" preview="true"/>
                            </div>
                        </div>
                    </div>
                </div>
				<h4 class="form-unit">${text('系统信息')}</h4>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('创建人')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="createBy" maxlength="64" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('创建日期')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="createDate" readonly="true" maxlength="20" class="form-control laydate"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" disabled="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('最后修改者')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="updateBy" maxlength="64" class="form-control" readonly="true"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('最后修改时间')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="updateDate" readonly="true" maxlength="20" class="form-control laydate"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" disabled="true"/>
						</div>
					</div>
				</div>
			</div>
		</div>
		<h4 class="form-unit">${text('相关财务记录')}</h4>
		<div class="ml10 mr10">
			<table id="tfinancingServiceOrderDetailDataGrid3"></table>
			<% if (hasPermi('financing:finserviceorder:finServiceOrder:edit')){ %>
			<a href="#" id="tfinancingServiceOrderDetailDataGridAddRowBtn3" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> ${text('增行')}</a>
			<% } %>
		</div>
		<div class="box-footer">
			<div class="row">
				<div class="col-sm-offset-2 col-sm-10">
					<% if (hasPermi('financing:finserviceorder:finServiceOrder:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
					<% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
				</div>
			</div>
		</div>
		<input type="hidden" name="area" value="">
		<input type="hidden" name="brand" value="">
	</#form:form>
</div>
</div>
<% } %>
<script>
	//初始化融资服务订单明细DataGrid对象
	$("#tfinancingServiceOrderDetailDataGrid1").dataGrid({
		data: ${toJson(finServiceOrder.tfinancingServiceOrderDetailList1)},
		datatype: "local", // 设置本地数据
		autoGridHeight: function(){return 'auto'}, // 设置自动高度

		// 设置数据表格列
		columnModel: [
			{header:'状态', name:'status', editable:true, hidden:true},
			{header:'类型', name:'type', editable:true, hidden:true, formatter:"integer",formatoptions: { defaultValue: '1' } ,},
			{header:'行号', name:'rowNumber', editable:true, hidden:true},
			{header:'主键', name:'financingServiceOrderDetailId', editable:true, hidden:true},
			{header:'${text("保证金比例")}', name:'marginRatio', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control'}},
			{header:'${text("保证金金额")}', name:'marginAmount', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control number'}},
			{header:'${text("利率")}', name:'interestRate', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control'}},
			{header:'${text("开始天数")}', name:'startDays', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits'}},
			{header:'${text("结束天数")}', name:'endDays', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits'}},
			{header:'${text("开始日期")}', name:'startDate', width:150,editable:false, edittype:'text', editoptions:{'class':'form-control'}},
			{header:'${text("结束日期")}', name:'endDate', width:150,editable:false, edittype:'text', editoptions:{'class':'form-control'}},
			{header:'${text("利息")}', name:'interest', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control number'}},
			{header:'${text("备注")}', name:'remark', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'255', 'class':'form-control'}},
			{header:'${text("保证金预收")}', name:'endDays', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits'}
			,formatter:function(cellvalue, options, rowObject){
				return "<a href=" +
						"\"${ctx}/financing/finserviceorder/finServiceOrder/finAdFrom?" +
						"financingServiceOrderId=${finServiceOrder.financingServiceOrderId}&money="+rowObject.marginAmount+"&rowId="+rowObject.rowNumber+
						"\" id=\"bt2\"\n" +
						"\t\t\t\t   class=\"btn btn-primary addTabPage\" title=\"${text('保证金预收')}\"\n" +
						"\t\t\t\t   data-layer=\"true\" data-layer-width=\"600\" data-layer-height=\"400\"\n" +
						"\t\t\t\t> ${text('保证金预收')}</a>";},

			},
			{header:'${text("融资服务订单ID")}', name:'financingServiceOrderId.financingServiceOrderId', editable:false, hidden:true},
			// {header:'${text("操作")}', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
			// 	var actions = [];
			// 	if (val == 'new'){
			// 		actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#tfinancingServiceOrderDetailDataGrid1\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
			// 	}else{
			// 		actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#tfinancingServiceOrderDetailDataGrid1\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
			// 	}
			// 	return actions.join('');
			// }, editoptions: {defaultValue: 'new'}}
		],

		// 编辑表格参数
		editGrid: true,				// 是否是编辑表格
		editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
		editGridAddRowBtn: $('#tfinancingServiceOrderDetailDataGridAddRowBtn1'),	// 子表增行按钮
		editGridAddRowInitData: {financingServiceOrderDetailId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

		// 编辑表格的提交数据参数
		editGridInputFormListName: 'tfinancingServiceOrderDetailList', // 提交的数据列表名
		editGridInputFormListAttrs: 'status,financingServiceOrderDetailId,marginRatio,marginAmount,interestRate,startDays,endDays,startDate,endDate,interest,remark,type,financingServiceOrderId.financingServiceOrderId,', // 提交数据列表的属性字段

		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
	$("#tfinancingServiceOrderDetailDataGrid2").dataGrid({
		data: ${toJson(finServiceOrder.tfinancingServiceOrderDetailList2)},
		datatype: "local", // 设置本地数据
		autoGridHeight: function(){return 'auto'}, // 设置自动高度

		// 设置数据表格列
		columnModel: [
			{header:'状态', name:'status', editable:true, hidden:true},
			{header:'类型', name:'type', editable:true, hidden:true, formatter:"integer",formatoptions: { defaultValue: '2' } ,},
			{header:'行号', name:'rowNumber', editable:true, hidden:true},
			{header:'主键', name:'financingServiceOrderDetailId', editable:true, hidden:true},
			{header:'${text("保证金比例")}', name:'marginRatio', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control'}},
			{header:'${text("保证金金额")}', name:'marginAmount', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control number'}},
			{header:'${text("利率")}', name:'interestRate', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control'}},
			{header:'${text("开始天数")}', name:'startDays', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits'}},
			{header:'${text("结束天数")}', name:'endDays', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits'}},
			{header:'${text("开始日期")}', name:'startDate', width:150,editable:false, edittype:'text', editoptions:{'class':'form-control'}},
			{header:'${text("结束日期")}', name:'endDate', width:150,editable:false, edittype:'text', editoptions:{'class':'form-control'}},
			{header:'${text("利息")}', name:'interest', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control number'}},
			{header:'${text("备注")}', name:'remark', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'255', 'class':'form-control'}},
			{header:'${text("保证金预付")}', name:'endDays', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits'}
				,formatter:function(cellvalue, options, rowObject){
					return "<a href=" +
							"\"${ctx}/financing/finserviceorder/finServiceOrder/finPreFrom?" +
							"financingServiceOrderId=${finServiceOrder.financingServiceOrderId}&money="+rowObject.marginAmount+"&rowId="+rowObject.rowNumber+
							"\" id=\"bt2\"\n" +
							"\t\t\t\t   class=\"btn btn-primary addTabPage\" title=\"${text('保证金预付')}\"\n" +
							"\t\t\t\t   data-layer=\"true\" data-layer-width=\"600\" data-layer-height=\"400\"\n" +
							"\t\t\t\t> ${text('保证金预付')}</a>";},

			},
			{header:'${text("融资服务订单ID")}', name:'financingServiceOrderId.financingServiceOrderId', editable:false, hidden:true},
			// {header:'${text("操作")}', name:'actions', width:80, sortable:false, fixed:false, formatter: function(val, obj, row, act){
			// 		var actions = [];
			// 		if (val == 'new'){
			// 			actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#tfinancingServiceOrderDetailDataGrid2\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
			// 		}else{
			// 			actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#tfinancingServiceOrderDetailDataGrid2\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
			// 		}
			// 		return actions.join('');
			// 	}, editoptions: {defaultValue: 'new'}}
		],

		// 编辑表格参数
		editGrid: true,				// 是否是编辑表格
		editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
		editGridAddRowBtn: $('#tfinancingServiceOrderDetailDataGridAddRowBtn2'),	// 子表增行按钮
		editGridAddRowInitData: {financingServiceOrderDetailId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

		// 编辑表格的提交数据参数
		editGridInputFormListName: 'tfinancingServiceOrderDetailList', // 提交的数据列表名
		editGridInputFormListAttrs: 'status,financingServiceOrderDetailId,marginRatio,marginAmount,interestRate,startDays,endDays,startDate,endDate,interest,remark,type,financingServiceOrderId.financingServiceOrderId,', // 提交数据列表的属性字段

		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
	$("#tfinancingServiceOrderDetailDataGrid3").dataGrid({
		data: ${toJson(finServiceOrder.financialRecordsList)},
		datatype: "local", // 设置本地数据
		autoGridHeight: function(){return 'auto'}, // 设置自动高度

		// 设置数据表格列
		columnModel: [
			{header:'主键', name:'billID', editable:false, hidden:true},
			{header:'${text("单据类型")}', name:'billType', width:150, editable:true, edittype:'select', editoptions:{'maxlength':'10', 'class':'form-control','readonly':'true',
					items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('erp_record_type')}),
					itemLabel: 'dictLabel', itemValue: 'dictValue'}
					},
			{header:'${text("单号")}', name:'billCode', width:150, editable:false, edittype:'text',
				formatter: function(val, obj, row, act){
					return '<a href="${ctx}/financing/finserviceorder/finServiceOrder/forwardByBillCodeAndType?parentBillType='+row.billType+'&parentBillCode='+row.billID+'" ' +
							'class="btnList" data-title="${text("查看订单")}">'+(val||row.id)+'</a>';
				}, editoptions:{'class':'form-control number','readonly':'true',}},
			{header:'${text("日期")}', name:'date', width:150,
				formatter:'date', formatoptions:{srcformat:'Y-m-d',newformat:'Y-m-d'},
				editable:false, edittype:'text', editoptions:{'class':'form-control laydate', 'readonly':'true',
					dataInit: function(element){
						laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
					}
				}
			},
			{header:'${text("费用项目")}', name:'expenseItem', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits','readonly':'true',}},
			{header:'${text("金额")}', name:'apAmount', width:150, editable:false, edittype:'text', editoptions:{'class':'form-control digits','readonly':'true',}},
			{header:'${text("状态")}', name:'status1', width:150, editable:true, edittype:'select', editoptions:{'class':'form-control digits','readonly':'true',
					items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('tar_status')}),
					itemLabel: 'dictLabel', itemValue: 'dictValue'}
				},
		],

		// 编辑表格参数
		editGrid: true,				// 是否是编辑表格
		editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
		editGridAddRowBtn: $('#tfinancingServiceOrderDetailDataGridAddRowBtn3'),	// 子表增行按钮
		editGridAddRowInitData: {financingServiceOrderDetailId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

		// 编辑表格的提交数据参数
		editGridInputFormListName: 'financialRecordsList', // 提交的数据列表名
		editGridInputFormListAttrs: 'billID,billType,billCode,date,expenseItem,apAmount,status1', // 提交数据列表的属性字段

		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
</script>
